package com.study.spring.hadoop;

import org.apache.hadoop.fs.FileStatus;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.data.hadoop.fs.FsShell;

@SpringBootApplication
public class HadoopApplication implements CommandLineRunner {

    @Autowired
    FsShell fsShell;


    public static void main(String[] args) {
        SpringApplication.run(HadoopApplication.class,args);
    }

    @Override
    public void run(String... args) throws Exception {

        System.out.println("=========run start============");
        for (FileStatus fileStatus : fsShell.lsr("/")) {
            System.out.println(">" + fileStatus.getPath());
        }
        System.out.println("===========run end===========");

    }
}
